#pragma once


class Color
{
public:
        Color() { }
        Color(float r, float g, float b): _red(r), _green(g), _blue(b) { }
        Color(float r, float g, float b, float a): _red(r), _green(g), _blue(b), _alpha(a) { }
        Color(const Color& rhs): _red(rhs._red), _green(rhs._green), _blue(rhs._blue), _alpha(rhs._alpha) {}

    float red() const { return _red; }
    float green() const { return _green; }
    float blue() const { return _blue; }

    Color& operator=(const Color& rhs)
    {
        _red   = rhs._red;
        _green = rhs._green;
        _blue  = rhs._blue;
        _alpha = rhs._alpha;
        return *this;
    }

    Color mix(const Color& color2, float t)
    {
        if (t < 0.0f) t = 0.0f;
        if (t > 1.0f) t = 1.0f;
        Color color;
        color._red   = t * _red   + (1.0f - t) * color2._red;
        color._green = t * _green + (1.0f - t) * color2._green;
        color._blue  = t * _blue  + (1.0f - t) * color2._blue;
        return color;
    }

    Color operator*(const Color& rhs) const
    {
        return Color(
            _red   * rhs._red,
            _green * rhs._green,
            _blue  * rhs._blue,
            _alpha * rhs._alpha
        );
    }

private:
    float _red   = 0.0f;
    float _green = 0.0f;
    float _blue  = 0.0f;
    float _alpha = 1.0f;
};